#ifndef NODE_H
#define NODE_H

#include<bits/stdc++.h>
#include"driver.h"
#define SYM_COMPUNIT     0
#define SYM_CONSTDECL    1
#define SYM_VARDECL      2
#define SYM_CONSTDEF     3
#define SYM_VARDEF       4
#define SYM_FUNCDEF      5
#define SYM_CONSTINITVAL 6
#define SYM_INITVAL      7
#define SYM_FUNCFPARAMS  8
#define SYM_PARAM        9
#define SYM_BLOCK        10
#define SYM_BRANCH       11
#define SYM_IF           12
#define SYM_ELSE         13
#define SYM_WHILE        14
#define SYM_FOR          15
#define SYM_BREAK        16
#define SYM_CONTINUE     17
#define SYM_RETURN       18
#define SYM_COND         19
#define SYM_FUNC         20
#define SYM_CONSTEXP     21
#define SYM_EXP          22
#define SYM_BRAKET       23
#define SYM_ASSIGN       24
#define SYM_ADD          25
#define SYM_MINUS        26
#define SYM_MUL          27
#define SYM_DIV          28
#define SYM_MOD          29
#define SYM_NEGATIVE     30
#define SYM_NOT          31
#define SYM_AND          32
#define SYM_OR           33
#define SYM_GRATER       34
#define SYM_LESS         35
#define SYM_NOTLESS      36
#define SYM_NOTGRATER    37
#define SYM_EQUAL        38
#define SYM_NOTEQUAL     39
#define SYM_EMPTY        40
#define SYM_LIST         41
#define SYM_INT          42
#define SYM_FLOAT        43
#define SYM_TYPE_INT     44
#define SYM_TYPE_FLOAT   45
#define SYM_TYPE_VOID    46
#define SYM_ID           47
#define SYM_M            48
#define SYM_N            49

using namespace std;
struct driver;
typedef struct node{
  int		int_val;
  float	float_val;
  string*	type_val;
  driver*	myDriver;
  int		nodeType;
  int		tag;
  int		type;//0 nothing 1 end 2 relative 
  int 		dimension;
  int		cal_type; //0 int 1 float
  int		cal_int;
  double	cal_float;
  int 		lineno;
  string	prefix;
  string	relativePrefix;
  vector<struct node*> children;
  node* 	parent;
  node(int tag,int nodeType);
  node(int tag,int nodeType,string type_val);
  std::string getName();
  void add(node* child);
  void analyze();
  void push(initializer_list<node*> li);
  void output();
  void display(int dep);
}Node;

struct nodeDriver:driver{
  struct node* drive;
  nodeDriver();
  nodeDriver(node* drive);
  node* getNode();
};

typedef union{
  struct node* ptr;
}YYLVAL;


extern node* root;

int OP2_const    (driver* originDriver);
int VAL_const    (driver* originDriver);
#endif
